public class Mystack {
    private String[] data;
    private int size;

    public Mystack(int capacity) {
        data = new String[capacity];
        size = 0;
    }

    public void push(String s) {
        if (size == data.length) {
            throw new RuntimeException("栈满了");
        }
        data[size++] = s;
    }
    public String pop() {
        if (size == 0) {
            System.out.println("栈空了");
            return null;
        } else {
            // 取出栈顶元素
            String s = data[size - 1];
            data[size - 1] = null;
            size--;
            return s;
        }
    }

//    public boolean pop() {
//    }
}

